package com.naiterui.ehp.bs.patient.repository;

import java.util.List;

import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import com.naiterui.common.repository.core.BaseJpaRepository;
import com.naiterui.ehp.bp.domain.DrStarInfo;

/**
 * <pre>
 *
 * </pre>
 *
 * @author fangguanhong
 * @date 2020/4/10 下午3:55
 * @since 1.0.0
 */
@Repository
public interface IApDrStarInfoRepository extends BaseJpaRepository<DrStarInfo, Long> {

    @Query(nativeQuery = true, value = "SELECT D.title_id titleId,D.`name` name ,DSI.background_img,DSI.fuzzy_img,IFNULL((SELECT DD.name FROM " +
            "dr_department AS DD WHERE DD.id =D.department_id),D.custom_department) AS departmentName FROM dr_star_info AS DSI LEFT JOIN doctor AS " +
            "D ON DSI.doctor_id = D.id LIMIT 0,?1")
    List<Object[]> findDrStarInfo(int num);
}
